
package calistoweb;

import java.sql.*;
import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleResultSet;
import oracle.jdbc.driver.OracleTypes;


class BDStatements extends BDConnection{
    
    public BDStatements(){

        super("jdbc:oracle:thin:@192.168.183.2:1521:orcl","R4197025","4197025");
              
        this.conectar();
        
    }

    protected void finalize() throws Throwable{

        super.finalize();

        this.desconectar();

    }

    OracleResultSet nome_colunas(String select) throws SQLException{

        String sql = (""
            + "declare "
            + "begin "
            + "info_tabelas.nome_colunas(?,?); "
            + "end;");

        OracleCallableStatement pstmt = (OracleCallableStatement) con.prepareCall(sql);

        pstmt.setString(1,select);

        pstmt.registerOutParameter(2, OracleTypes.CURSOR);

        pstmt.execute();

        return (OracleResultSet) pstmt.getCursor(2);

    }

  }
